﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium;

namespace AutoTestingFramework.Core.Controls
{
    public class WebElement : IWebElement
    {
        private IWebElement m_Element;

        public IWebElement Element
        {
            get { return m_Element; }
            set { m_Element = value; }
        }

        #region Base Methods, Not changed
        public void Clear()
        {
            Clear();
        }

        public void Click()
        {
            Element.Click();
        }

        public bool Displayed
        {
            get { return Element.Displayed; }
        }

        public bool Enabled
        {
            get { return Element.Enabled; }
        }

        public string GetAttribute(string attributeName)
        {
            return Element.GetAttribute(attributeName);
        }

        public string GetCssValue(string propertyName)
        {
            return Element.GetAttribute(propertyName);
        }

        public System.Drawing.Point Location
        {
            get { return Element.Location; }
        }

        public bool Selected
        {
            get { return Element.Selected; }
        }

        public void SendKeys(string text)
        {
            Element.SendKeys(text);
        }

        public System.Drawing.Size Size
        {
            get { return Element.Size; }
        }

        public void Submit()
        {
            Element.Submit();
        }

        public string TagName
        {
            get { return Element.TagName; }
        }

        public string Text
        {
            get { return Element.Text; }
        }

        public IWebElement FindElement(By by)
        {
            return Element.FindElement(by);
        }

        public System.Collections.ObjectModel.ReadOnlyCollection<IWebElement> FindElements(By by)
        {
            return Element.FindElements(by);
        }
        #endregion
        public WebElement(IWebElement Element)
        {
            this.Element = Element;

        }
        public void ClearAndSendKeys(string text)
        {
            this.Clear();
            this.SendKeys(text);
        }
    }
}
